<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
	 <link rel="stylesheet" th:href="@{/bbs/css/layui.css}">
		<link rel="stylesheet" th:href="@{/bbs/css/global.css}">
		<link rel="stylesheet" th:href="@{/bbs/css/mylay.css}">
		<link rel="stylesheet" th:href="@{/bbs/css/wap2app.css}">
		<link rel="icon"  type="image/x-icon">
		<script th:src="@{/bbs/js/util.js}"></script>
		<script th:src="@{/bbs/js/jquery-3.4.1.min.js}"></script>
		<script th:src="@{/bbs/js/community.js}" type="application/javascript"></script>
		<script th:src="@{/bbs/js/sweetalert.min.js}"></script>
		<script th:src="@{/bbs/js/plusShare.js}" type="text/javascript"></script>
		<script th:src="@{/bbs/js/wap2app.js}" type="text/javascript"></script>
		<link rel="stylesheet" th:href="@{/bbs/css/community.css}">
  
<body>

<div></div>



<div class="layui-container">
  		标题：
          	<input width=100px id="title" />
          	<br /><br /><br />
		板块：
          	<select id="sectionId" >
          		<option  th:each="section : ${sectionList}"  th:value="${section.id}" th:text="${section.name}" ></option>
          	</select>
          	<br /><br /><br />
        <div class="layui-form layui-form-pane">
          <input type="hidden" id="question_id" value="1360">
          <div class="layui-form-item layui-form-text">
          	
            <a name="comment"></a>
            <div class="layui-input-block">
              <textarea id="content" name="content" required="" lay-verify="required" placeholder="请输入内容" class="layui-textarea talk-editor" style="height: 250px;"></textarea>
            </div>
          </div>
          <div class="layui-form-item">
            <input type="hidden" >
            <button onclick="add()" class="layui-btn">发表</button>
          </div>
          
        </div>
      </div>

     
    </div>
    
  </div>
</div>
<script>
	
	function add(){
		var content = $("#content").val()
		if(content == null || content == ''){
			alert('请输入内容')
			return;
		}
		$.ajax({
			url: '/gym/bbs/topic/addTopic',
			data: {
				content: content,
				sectionId: $("#sectionId").val(),
				title: $("#title").val()
			},
			success: function(res){
				if(res.code == 0){
					alert('发表成功')
					location.href='/gym/bbs/topic/index';
				}
			}
		});
		
	}
</script>



</body></html>